""#line:3
import paddle #line:4
import paddle .nn .functional as F #line:5
from paddle .nn import Layer #line:6
from paddle .vision .datasets import MNIST #line:7
from paddle .metric import Accuracy #line:8
from paddle .nn import Conv2D ,MaxPool2D ,Linear #line:9
from paddle .static import InputSpec #line:10
from paddle .vision .transforms import ToTensor #line:11
print (paddle .__version__ )#line:13
train_dataset =MNIST (mode ='train',transform =ToTensor ())#line:16
test_dataset =MNIST (mode ='test',transform =ToTensor ())#line:17
class MyModel (Layer ):#line:20
    ""#line:23
    def __init__ (O0OOOO00O0OO000OO ):#line:24
        super (MyModel ,O0OOOO00O0OO000OO ).__init__ ()#line:25
        O0OOOO00O0OO000OO .conv1 =paddle .nn .Conv2D (in_channels =1 ,out_channels =6 ,kernel_size =5 ,stride =1 ,padding =2 )#line:26
        O0OOOO00O0OO000OO .max_pool1 =MaxPool2D (kernel_size =2 ,stride =2 )#line:27
        O0OOOO00O0OO000OO .conv2 =Conv2D (in_channels =6 ,out_channels =16 ,kernel_size =5 ,stride =1 )#line:28
        O0OOOO00O0OO000OO .max_pool2 =MaxPool2D (kernel_size =2 ,stride =2 )#line:29
        O0OOOO00O0OO000OO .linear1 =Linear (in_features =16 *5 *5 ,out_features =120 )#line:30
        O0OOOO00O0OO000OO .linear2 =Linear (in_features =120 ,out_features =84 )#line:31
        O0OOOO00O0OO000OO .linear3 =Linear (in_features =84 ,out_features =10 )#line:32
    def forward (O0O0O00OO00OO0000 ,OOO0OOOOO00OOOO00 ):#line:34
        ""#line:37
        OOO0OOOOO00OOOO00 =O0O0O00OO00OO0000 .conv1 (OOO0OOOOO00OOOO00 )#line:38
        OOO0OOOOO00OOOO00 =F .relu (OOO0OOOOO00OOOO00 )#line:39
        OOO0OOOOO00OOOO00 =O0O0O00OO00OO0000 .max_pool1 (OOO0OOOOO00OOOO00 )#line:40
        OOO0OOOOO00OOOO00 =F .relu (OOO0OOOOO00OOOO00 )#line:41
        OOO0OOOOO00OOOO00 =O0O0O00OO00OO0000 .conv2 (OOO0OOOOO00OOOO00 )#line:42
        OOO0OOOOO00OOOO00 =O0O0O00OO00OO0000 .max_pool2 (OOO0OOOOO00OOOO00 )#line:43
        OOO0OOOOO00OOOO00 =paddle .flatten (OOO0OOOOO00OOOO00 ,start_axis =1 ,stop_axis =-1 )#line:44
        OOO0OOOOO00OOOO00 =O0O0O00OO00OO0000 .linear1 (OOO0OOOOO00OOOO00 )#line:45
        OOO0OOOOO00OOOO00 =F .relu (OOO0OOOOO00OOOO00 )#line:46
        OOO0OOOOO00OOOO00 =O0O0O00OO00OO0000 .linear2 (OOO0OOOOO00OOOO00 )#line:47
        OOO0OOOOO00OOOO00 =F .relu (OOO0OOOOO00OOOO00 )#line:48
        OOO0OOOOO00OOOO00 =O0O0O00OO00OO0000 .linear3 (OOO0OOOOO00OOOO00 )#line:49
        return OOO0OOOOO00OOOO00 #line:50
inputs =InputSpec ([None ,784 ],'float32','x')#line:53
labels =InputSpec ([None ,10 ],'float32','x')#line:54
model =paddle .Model (MyModel (),inputs ,labels )#line:55
optim =paddle .optimizer .Adam (learning_rate =0.001 ,parameters =model .parameters ())#line:57
model .prepare (optim ,paddle .nn .CrossEntropyLoss (),Accuracy ())#line:63
model .fit (train_dataset ,test_dataset ,epochs =1 ,batch_size =64 ,save_dir ='mnist_checkpoint',verbose =1 )
